package idiet.service;

import idiet.bean.MealFamily;
import idiet.dao.hibernate.MealFamilyDao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository("mealFamilyService")
public class MealFamilyService {
	@Autowired
	MealFamilyDao mealFamilyDao;
	public MealFamily getMealFamilyById(int familyId){
		return this.mealFamilyDao.getMealFamilyById(familyId);
	}
	public List<MealFamily> getMealFamilysByMealFamilyName(String mealFamilyName){
		if(mealFamilyName==null){
			return this.mealFamilyDao.getMealFamilys();
		}else{
			return this.mealFamilyDao.getMealFamilysByMealFamilyName(mealFamilyName);
		}
	}
	public void createMealFamily(MealFamily family){
		this.mealFamilyDao.createMealFamily(family);
	}
	public void updateMealFamily(MealFamily family){
		this.mealFamilyDao.updateMealFamily(family);
	}
	public void deleteMealFamily(MealFamily family){
		this.mealFamilyDao.deleteMealFamily(family);
	}
}
